package com.puneet.graphqueries.ssh;

import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Session;

public class SSHBase {
	public Session openSession(String host,String user) throws JSchException {
		JSch jsch = new JSch();
		Session session = jsch.getSession(user, host, 22);
		jsch.addIdentity(System.getProperty("user.home") + "/.ssh/id_rsa");
		jsch.setKnownHosts(System.getProperty("user.home") + "/.ssh/known_hosts");
		SSHUserInfo ui = new SSHUserInfo();
		ui.setTrust(true);
		session.connect();
		return session;
	}
}
